using System;
using System.IO;

namespace PS.WebParts.Rollup.Utils
{
    public static class SimpleLogger
    {
        private static readonly string logFolder = Path.Combine(Path.GetTempPath(), "Rollup");

        static SimpleLogger()
        {
            Directory.CreateDirectory(logFolder);
        }

        public static void Write(string format, params string[] messages)
        {
#if DEBUG
            string fileName = Path.Combine(logFolder, DateTime.Today.ToString("d MMM yyyy") + ".log");
            using (StreamWriter sw = new StreamWriter(fileName, true))
            {
                sw.WriteLine(string.Format("[{0}] {1}", DateTime.Now.ToString("HH:mm:ss"), string.Format(format, messages)));
            }
#endif
        }
    }
}